package com.topisv.tms.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.SubWarehouseRel;

public interface SubWarehouseRelDao extends PagingAndSortingRepository<SubWarehouseRel, Long>, JpaSpecificationExecutor<SubWarehouseRel> {

	@Query("select t from SubWarehouseRel t where t.mainWarehouseCode=? order by t.priority")
	List<SubWarehouseRel> findByMainWarehouseCode(String warehouse);
	
	@Modifying
	@Query("delete from SubWarehouseRel where mainWarehouseCode=? ")
	void deleteByMainWarehouseCode(String warehouse);
	SubWarehouseRel findBySubWarehouseCode(String subWarehouseCode);
	
	
}